﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MultiUpload.ascx.cs"
  Inherits="ITViet.Web.Controls.MultiUpload" %>
<link rel="Stylesheet" type="text/css" href="../css/swfUpload.css" />

<script type="text/javascript" src="../Scripts/swfupload.js"></script>

<script type="text/javascript" src="../Scripts/swfupload.queue.js"></script>

<script type="text/javascript" src="../Scripts/fileprogress.js"></script>

<script type="text/javascript" src="../Scripts/handlers.js"></script>

<script type="text/javascript">
		var uploader = null;
		var FileType = '<%=FileType%>';
		var completeFunction = '<%=UploadCompleteFunction %>';
		var uploadSessionName = '<%=UploadSessionName %>';
		var maxFile = '<%=MaxFile %>';
		var btnCancelName = '<%=ButtonCancelName %>';
		var btnUploadName = '<%=ButtonUploadName %>';
		window.onload = function () {
			createUploader();
		}
		
		function createUploader()
		{   
		  if(uploader == null)
		    uploader = new SWFUpload({
				// Backend Settings
				upload_url: "UploadPage.aspx",
                post_params : {
                    "ASPSESSID" : "<%=Session.SessionID %>"
                },

				// File Upload Settings
				file_size_limit : "10 MB",
				file_types : FileType,
				file_types_description : "",
				file_upload_limit : maxFile,    // Zero means unlimited
				file_queue_limit : maxFile,
				file_post_name : uploadSessionName,

				// Event Handler Settings - these functions as defined in Handlers.js
				//  The handlers are not part of SWFUpload but are part of my website and control how
				//  my website reacts to the SWFUpload events.
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_dialog_start_handler : fileDialogStart,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Button settings
				button_image_url : "",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 55,
				button_height: 22,
				button_text : '<span class="button"><%=(string)GetGlobalResourceObject("Strings","Browse") %></span>',
				button_text_style : '.button {font-family: Tahoma; font-size: 12pt;color:#60A4A8; font-weight:bold;}',
				button_text_top_padding: 1,
				button_text_left_padding: 5,
				button_cursor : SWFUpload.CURSOR.HAND,
				button_text_top_padding: 3,

				// Flash Settings
				flash_url : "../css/Swf/swfupload.swf",	// Relative to this file
				flash9_url : "../css/Swf/swfupload_FP9.swf",	// Relative to this file

				custom_settings : {
					progressTarget : "divFileProgressContainer",
					cancelButtonId : "btnCancel1",
					uploadButtonId : "btnUpload",
					finishedUpload : completeFunction
				},

				// Debug Settings
				debug: false
			});
		}
</script>

<div id="content">
  <div id="swfu_container" style="margin: 0px 10px;">
    <div>
      <span id="spanButtonPlaceholder"></span>
      <input id="btnUpload" type="button" value="Upload" onclick="doUpload(uploader);return false;"
        class="upload_button" />
      <input id="btnCancel1" type="button" value="Cancel Uploads" onclick="uploader.cancelQueue();return false;"
        class="upload_button" />
    </div>
    <div style="clear: both; padding: 5px 0 5px 2px;">
      <label style="color: #666666">
        <%=NoticeMessage %>
      </label>
    </div>
    <div id="divFileProgressContainer" class="fieldset flash" style="overflow: auto;
      height: 200px;">
      <span class="legend">
        <%=QueueTitle %></span>
    </div>
    <div id="thumbnails">
    </div>
  </div>
</div>
